<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>企业信息</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/static/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/static/layuiadmin/style/admin.css" media="all">

    <style>
        .layui-hide{  /*最后的pic为字段的field*/
            height: 100%;
            max-width: 100%;
        }
        .layui-table-cell{
            height:auto !important;
        }
    </style>
</head>
<body>



<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header">公司信息</div>
                <div class="layui-card-body">

                    <table class="layui-hide" id="test-table-operate" lay-filter="test-table-operate" lay-size="lg">



                    </table>
                    <script type="text/html" id="test-pass">

                    </script>
                    <script type="text/html" id="test-table-operate-barDemo">


                        <a class="layui-btn layui-bg-green layui-btn-xs" lay-event="edit">修改</a>


                    </script>
                </div>
            </div>
        </div>
    </div>
</div>

<script src="/static/layuiadmin/layui/layui.js"></script>
<script>
    layui.config({
        base: '/static/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index','form','table','laydate','set','layedit','upload'], function(){
        $ = layui.jquery;
        var table = layui.table
            ,admin = layui.admin
            ,element = layui.element
            ,layer = layui.layer
            ,laydate = layui.laydate,
            upload = layui.upload
            ,form = layui.form;

        table.render({
            elem: '#test-table-operate'
            ,url: "{:url('System/system')}"
            ,height: 'full-100'
            ,cols: [[
                {field:'id',align:"center",title: 'ID'}
                ,{field:'company_logo',align:"center",title: 'LOGO',style:"height:100px;",templet:function(d){
                        return "<img src='" +d.company_logo+ "' style='width:140px;height:100px;'>"}}
                ,{field:'company_phone',align:"center",title: '手机号'}
                ,{field:'company_email',align:"center",title: '邮箱'}
                ,{field:'company_code',align:"center",title: '备案号'}
                ,{width:150,align:'center', title: '操作',fixed: 'right', toolbar: '#test-table-operate-barDemo'}

            ]]
            ,page: true
            ,limit: 20
        });

        form.render(null, 'component-form-group');

        laydate.render({
            elem: '#LAY-component-form-group-date'
        });

        //监听工具条
        table.on('tool(test-table-operate)', function(obj){
            var data = obj.data;
            if(obj.event === 'edit'){
                window.location.href="{:url('System/editCompany')}"+'?id='+data.id;
            }
        });




        var $ = layui.$, active = {
            searchUserButton:function(){
                var search_goods_author  = $('#search_goods_author').val();

                var search_phone = $('#search_phone').val();
                var search_id = $('#search_id').val();
                table.reload('test-table-operate', {
                    where: {
                        search_goods_author:search_goods_author,
                        search_phone:search_phone,
                        search_id:search_id,
                    }
                    ,page: {
                        curr: 1 //重新从第 1 页开始
                    }
                });
                //return false;
            }
        };
        //绑定点击事件
        $('.test-table-operate-btn .layui-btn').on('click', function(){
            var type = $(this).data('type');
            active[type] ? active[type].call(this) : '';
        });


    });

</script>

</body>
</html>